package com.yxhl.zoume.core.func.appraisal.ui.activity;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;

import com.yxhl.zoume.R;
import com.yxhl.zoume.common.ui.activity.base.BaseActivityWithToolBar;
import com.yxhl.zoume.core.func.appraisal.model.AppraisalDriverInfo;
import com.yxhl.zoume.core.func.appraisal.ui.fragment.AppraisalConfirmFragment;
import com.yxhl.zoume.di.component.appraisal.AppraisalConfirmComponent;
import com.yxhl.zoume.di.component.appraisal.DaggerAppraisalConfirmComponent;
import com.yxhl.zoume.di.component.base.HasComponent;
import com.yxhl.zoume.di.module.ActivityModule;

/**
 * Created by vhawk on 16/9/18.
 */

public class AppraisalConfirmActivity extends BaseActivityWithToolBar implements HasComponent<AppraisalConfirmComponent> {

    private static final String KEY_DRIVER_INFO = "KEY_DRIVER_INFO";
    private AppraisalConfirmComponent component;

    public static Intent getCallingIntent(Activity activity, AppraisalDriverInfo driverInfo) {
        Intent intent = new Intent(activity, AppraisalConfirmActivity.class);
        intent.putExtra(KEY_DRIVER_INFO, driverInfo);
        return intent;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        AppraisalDriverInfo driverInfo = (AppraisalDriverInfo) getIntent().getSerializableExtra(KEY_DRIVER_INFO);
        addFragment(R.id.frame_activity_appraisal_confirm_body, AppraisalConfirmFragment.newInstance(driverInfo));
    }

    @Override
    protected void onHeaderLeftClick(View view) {
        finish();
    }

    @Override
    protected void onHeaderRightClick(View view) {

    }

    @Override
    protected int getLayoutResId() {
        return R.layout.activity_appraisal_confirm;
    }

    @Override
    protected void initializeInjector() {
        component = DaggerAppraisalConfirmComponent.builder()
                .appComponent(getAppComponent())
                .activityModule(new ActivityModule(this))
                .build();
    }

    @Override
    public AppraisalConfirmComponent getComponent() {
        return component;
    }
}
